﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Globalization;
namespace VB2CS
{
    public class DateAndTime
    {
        public static DateTime DateAdd(DateInterval Interval, double Number, DateTime DateValue)
        {
            //int years = (int)Math.Round(Conversion.Fix(Number));
            int years = Convert.ToInt32(Number);
            System.Globalization.Calendar _calendar = Thread.CurrentThread.CurrentCulture.Calendar;
            switch (Interval)
            {
                case DateInterval.Year:
                    return _calendar.AddYears(DateValue, years);

                case DateInterval.Quarter:
                    return DateValue.AddMonths(years * 3);

                case DateInterval.Month:
                    return _calendar.AddMonths(DateValue, years);

                case DateInterval.DayOfYear:
                case DateInterval.Day:
                case DateInterval.Weekday:
                    return DateValue.AddDays((double)years);

                case DateInterval.WeekOfYear:
                    return DateValue.AddDays(years * 7.0);

                case DateInterval.Hour:
                    return DateValue.AddHours((double)years);

                case DateInterval.Minute:
                    return DateValue.AddMinutes((double)years);

                case DateInterval.Second:
                    return DateValue.AddSeconds((double)years);
            }
            throw new ArgumentException("Argument InvalidValue of DateInterval");
        }


        public static object Day(DateTime datDate)
        {
            throw new NotImplementedException();
        }

        public static object Month(DateTime datDate)
        {
            throw new NotImplementedException();
        }

        public static object Year(DateTime datDate)
        {
            throw new NotImplementedException();
        }

        public static string MonthName(object p, bool p_2)
        {
            throw new NotImplementedException();
        }

        public static long DateDiff(DateInterval dateInterval, DateTime dateTime, DateTime dateTime_3, FirstDayOfWeek firstDayOfWeek, object p)
        {
            throw new NotImplementedException();
        }
        public static DateTime Now
        {
            get { return DateTime.Now; }
        }
    }
}
